package eu.telecom_bretagne.RECRUT.data.model;

import java.io.Serializable;
import javax.persistence.*;
import java.util.Set;


/**
 * The persistent class for the employe database table.
 * 
 */
@Entity
@NamedQuery(name="Employe.findAll", query="SELECT e FROM Employe e")
public class Employe implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="EMPLOYE_ID_GENERATOR", sequenceName="EMPLOYE_ID_SEQ", allocationSize=1)
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="EMPLOYE_ID_GENERATOR")
	private Integer id;

	private String departement;

	@Column(name="nom_employe")
	private String nomEmploye;

	@Column(name="prenom_employe")
	private String prenomEmploye;

	@Column(name="type_employe")
	private String typeEmploye;

	//bi-directional many-to-one association to Archive
	@OneToMany(mappedBy="employe")
	private Set<Archive> archives;

	//bi-directional many-to-many association to DossierCandidature
	@ManyToMany
	@JoinTable(
		name="index_dc_e"
		, joinColumns={
			@JoinColumn(name="id_employe")
			}
		, inverseJoinColumns={
			@JoinColumn(name="id_dossier_candidature")
			}
		)
	private Set<DossierCandidature> dossierCandidatures;

	//bi-directional many-to-one association to Offre
	@OneToMany(mappedBy="employe")
	private Set<Offre> offres;

	public Employe() {
	}

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getDepartement() {
		return this.departement;
	}

	public void setDepartement(String departement) {
		this.departement = departement;
	}

	public String getNomEmploye() {
		return this.nomEmploye;
	}

	public void setNomEmploye(String nomEmploye) {
		this.nomEmploye = nomEmploye;
	}

	public String getPrenomEmploye() {
		return this.prenomEmploye;
	}

	public void setPrenomEmploye(String prenomEmploye) {
		this.prenomEmploye = prenomEmploye;
	}

	public String getTypeEmploye() {
		return this.typeEmploye;
	}

	public void setTypeEmploye(String typeEmploye) {
		this.typeEmploye = typeEmploye;
	}

	public Set<Archive> getArchives() {
		return this.archives;
	}

	public void setArchives(Set<Archive> archives) {
		this.archives = archives;
	}

	public Archive addArchive(Archive archive) {
		getArchives().add(archive);
		archive.setEmploye(this);

		return archive;
	}

	public Archive removeArchive(Archive archive) {
		getArchives().remove(archive);
		archive.setEmploye(null);

		return archive;
	}

	public Set<DossierCandidature> getDossierCandidatures() {
		return this.dossierCandidatures;
	}

	public void setDossierCandidatures(Set<DossierCandidature> dossierCandidatures) {
		this.dossierCandidatures = dossierCandidatures;
	}

	public Set<Offre> getOffres() {
		return this.offres;
	}

	public void setOffres(Set<Offre> offres) {
		this.offres = offres;
	}

	public Offre addOffre(Offre offre) {
		getOffres().add(offre);
		offre.setEmploye(this);

		return offre;
	}

	public Offre removeOffre(Offre offre) {
		getOffres().remove(offre);
		offre.setEmploye(null);

		return offre;
	}

}